package com.lookme.lmtool.cracker.filter.color;

import com.jhlabs.image.GainFilter;
import com.lookme.lmtool.cracker.CrackerConstants;
import com.lookme.lmtool.cracker.annotation.FilterAnnotation;
import com.lookme.lmtool.cracker.annotation.ParamAnnotation;
import com.lookme.lmtool.cracker.filter.AbstractFilter;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;

import java.awt.image.BufferedImageOp;

@FilterAnnotation(groupName = CrackerConstants.FILTER_GROUP_NAME_COLOR,name="色彩增值",filterClass = GainFilter.class)
public class FilterGain extends AbstractFilter {

    @XStreamAsAttribute
    @ParamAnnotation(name = "增值", desc = "增值",inputType = ParamAnnotation.InputType.Spinner,amountToStepBy = 0.1,max = 256)
    private float gain=0.5f;
    @XStreamAsAttribute
    @ParamAnnotation(name = "偏置", desc = "偏置",inputType = ParamAnnotation.InputType.Spinner,amountToStepBy = 0.1,max = 256)
    private float bias=0.5f;

    @Override
    public BufferedImageOp getFilter() {
        GainFilter filter= new GainFilter();
        filter.setGain(gain);
        filter.setBias(bias);
        return filter;
    }

}
